<script setup>
import { ref } from 'vue';
import Login from './components/Login.vue';
import Register from './components/Register.vue';

const isLogin = ref(false);

function toggleForm() {
  isLogin.value = !isLogin.value;
}
</script>

<template>
  <div class="background">
    <div class="form-container">
      <Login v-if="isLogin" @toggle="toggleForm" />
      <Register v-else @toggle="toggleForm" />
      <button @click="toggleForm">
        {{ isLogin ? '切换到注册' : '切换到登录' }}
      </button>
    </div>
  </div>
</template>

<style scoped>
.background {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 90vw;
  height: 90vh;
  background-image: url('.\2.jpg');
}

.form-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 90%;
  height: 90%;
  background: rgba(255, 255, 255, 0.8); 
  padding: 2rem; 
  border-radius: 8px; 
}

button {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  border: none;
  background-color: #007BFF;
  color: white;
  border-radius: 4px;
  cursor: pointer;
}

button:hover {
  background-color: #0056b3;
}
</style>